load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "taskexecutor",
    srcs = [
        "interface.go",
        "manager.go",
        "register.go",
        "slot.go",
        "task_executor.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/disttask/framework/taskexecutor",
    visibility = ["//visibility:public"],
    deps = [
        "//br/pkg/storage",
        "//pkg/config",
        "//pkg/disttask/framework/dxfmetric",
        "//pkg/disttask/framework/handle",
        "//pkg/disttask/framework/metering",
        "//pkg/disttask/framework/proto",
        "//pkg/disttask/framework/scheduler",
        "//pkg/disttask/framework/storage",
        "//pkg/disttask/framework/taskexecutor/execute",
        "//pkg/kv",
        "//pkg/lightning/log",
        "//pkg/metrics",
        "//pkg/sessionctx",
        "//pkg/sessionctx/vardef",
        "//pkg/util",
        "//pkg/util/backoff",
        "//pkg/util/gctuner",
        "//pkg/util/injectfailpoint",
        "//pkg/util/intest",
        "//pkg/util/logutil",
        "//pkg/util/memory",
        "//pkg/util/traceevent",
        "//pkg/util/tracing",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_prometheus_client_golang//prometheus",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "taskexecutor_test",
    timeout = "short",
    srcs = [
        "main_test.go",
        "manager_test.go",
        "register_test.go",
        "slot_test.go",
        "task_executor_test.go",
        "task_executor_testkit_test.go",
    ],
    embed = [":taskexecutor"],
    flaky = True,
    shard_count = 14,
    deps = [
        "//pkg/disttask/framework/mock",
        "//pkg/disttask/framework/mock/execute",
        "//pkg/disttask/framework/proto",
        "//pkg/disttask/framework/scheduler",
        "//pkg/disttask/framework/storage",
        "//pkg/disttask/framework/taskexecutor/execute",
        "//pkg/disttask/framework/testutil",
        "//pkg/kv",
        "//pkg/testkit",
        "//pkg/testkit/testfailpoint",
        "//pkg/testkit/testsetup",
        "//pkg/util/logutil",
        "@com_github_ngaut_pools//:pools",
        "@com_github_pingcap_errors//:errors",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//util",
        "@org_uber_go_goleak//:goleak",
        "@org_uber_go_mock//gomock",
    ],
)
